package com.litt.saap.assistant.web;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import com.litt.core.web.mvc.action.BaseController;
import com.litt.saap.assistant.service.IQuickviewService;
import com.litt.saap.assistant.vo.QuickviewVo;
import com.litt.saap.common.vo.LoginUserVo;
import com.litt.saap.core.web.util.LoginUtils;


/**
 * .
 * 
 * <pre><b>描述：</b>
 *    
 * </pre>
 * 
 * <pre><b>修改记录：</b>
 *    
 * </pre>
 * 
 * @author <a href="mailto:littcai@hotmail.com">蔡源</a>
 * @since 2015年5月18日
 * @version 1.0
 */
@Controller
public class QuickviewController extends BaseController {
  
  @Resource
  private IQuickviewService quickviewService;
  
  @RequestMapping
  public ModelAndView findByModule(@RequestParam String moduleCode)
  {
    LoginUserVo loginUser = (LoginUserVo)LoginUtils.getLoginVo();
    int userId = loginUser.getOpId().intValue();
    int tenantId = loginUser.getTenantId();
    
    List<QuickviewVo> quickviewList = quickviewService.findByModuleAndUser(tenantId, moduleCode, userId);
    
    return new ModelAndView("jsonView").addObject("quickviewList", quickviewList);
  }

}
